package lambda;

import lambda.i.ReturnOneParam;

/**
 * @author LIBOFEI
 * @ClassName LambdaTest3
 * @description
 * @date 2020/10/9 14:10
 * @Version 1.0
 **/
public class LambdaTest3 {

    public static void main(String[] args) {


        //方法归属者::方法名
        // 静态方法的归属者为类名，普通方法归属者为对象
        LambdaTest3 test3 = new LambdaTest3();


        ReturnOneParam lam1 = a -> doubleSum(a);
        System.out.println(lam1.method(3));

        ReturnOneParam lam2 = a -> test3.addTwo(a);
        System.out.println(lam2.method(3));


        ReturnOneParam lam3 =  LambdaTest3::doubleSum;
        System.out.println(lam3.method(3));

        ReturnOneParam lam4 = test3::addTwo;
        System.out.println(lam4.method(4));

    }

    public static int doubleSum(int a){
        return a * 2;
    }

    public int addTwo(int a){
        return a + 2;
    }
}
